﻿//----------------------------------------------------------------
// Desc: 
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2009-10-15
//
// Update Date :            
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
//----------------------------------------------------------------
#pragma once


typedef FUI_Vector< FU_AG_GRID* > FV_UI_AG_GRID_VEC;


//----------------------------------------------------------------
//
//----------------------------------------------------------------
class FAPI FUI_ArrayGridEx : public FUI_ArrayGrid
{
    FUI_DECLARE_CLASS(FUI_ArrayGridEx)

public:
    FUI_ArrayGridEx(EF_UI_WIDGET_TYPE t = eUWT_ArrayGridEx);
    virtual ~FUI_ArrayGridEx();
    virtual void Release();
    virtual void Render(EF_UI_RENDER_LAYER layer);
    virtual void UpdateRect();
    virtual bool IsChild(FUI_Object* pChild);
    virtual void SetHeight(funit h);
    virtual bool HasClip();
    virtual bool OnMouseWheel(bool bUp, funit nX, funit nY);
    virtual bool OnMouseMove(funit nX, funit nY);
    virtual bool OnLButtonDown(funit nX, funit nY);
    virtual bool OnLButtonUp(funit nX, funit nY);
    virtual void OnFrameHide(bool visable);

    virtual FU_AG_GRID* GetGrid(int index);
    virtual size_t GetCount(){ return vpGridVec.size(); }
    virtual int GetRowCount();
    virtual void Clear();

    // 添加格子
    FU_AG_GRID* AddGrid(DWORD id);
    // 查找格子
    FU_AG_GRID* FindGrid(DWORD id, size_t* ret_index = 0);
    // 删除格子
    bool DelGrid(DWORD id);

    // 获取部分控件数据
    FINLINE FUI_ScrollBar& GetScroll(){ return uScrollBar; }

protected:
    virtual void InitUIData(FUI_Object* father, fuWidgetBase* pData, FUI_Layout* layout);
    virtual void Update();

protected:
    fuWidgetArrayGridEx* pArrayGridDataEx;  // 控件数据地址
    FUI_ScrollBar uScrollBar;
    FV_UI_AG_GRID_VEC vpGridVec;            // 格子列表
};